/* 路由 总入口 */

import VueRouter from 'vue-router'; //这里拿到 vue-router 就可以去 new 实例了，跟 vue 没关系，别搞晕了 vue 在哪里导，Vue.use() 在哪里调

//各个组件我采用这种文件夹结构，方便后面要定义的路由和实际路径相对应，不容易迷糊
import homeRoute from './components/home/home.vue';
import memberRoute from './components/member/member.vue';
import searchRoute from './components/search/search.vue';
import shaopcarRoute from './components/shopcar/shopcar.vue';

import newsList from './components/home/home-newslist.vue';
import imgList from './components/home/home-imglist.vue';
import goodsList from './components/home/home-goodslist.vue';
import vidoList from './components/home/home-vidolist.vue';
import feedback from './components/home/home-feedback.vue';
import contact from './components/home/home-contact.vue';

import news from './components/home/home-newslist-news.vue';
import img from './components/home/home-imglist-img.vue';
import goods from './components/home/home-goodslist-goods.vue';
import desc from './components/home/home-goodslist-goods-desc.vue';
import prodrev from './components/home/home-goodslist-goods-prodrev.vue';

export default new VueRouter({
    routes: [
        { path: '/', redirect: '/home' },
        { path: '/home', component: homeRoute },
        { path: '/member', component: memberRoute },
        { path: '/shopcar', component: shaopcarRoute },
        { path: '/search', component: searchRoute },

        { path: '/home/newslist', component: newsList },
        { path: '/home/imglist', component: imgList },
        { path: '/home/goodslist', component: goodsList },
        { path: '/home/vidolist', component: vidoList },
        { path: '/home/feedback', component: feedback },
        { path: '/home/contact', component: contact },

        { path: '/home/newslist/news/:id', component: news },
        { path: '/home/imglist/img/:id', component: img },
        // { path: '/home/goodslist/goods:id', component: goods }, 
        // 命名路由的话比较方便管理路由地址
        { path: '/home/goodslist/goods/:id', component: goods, name:'goods-router-name' }, // 编程式导航的“命名路由”，命名，这里给配置个路由的名字，后面去调用;
        { path: '/home/goodslist/goods/desc/:id', component: desc},
        { path: '/home/goodslist/goods/prodrev/:id', component: prodrev},
    ],
    linkActiveClass: 'mui-active'
});